#include "Group.h"

// initialize the group
Group::Group(std::vector<Transaction>& producerPool, std::vector<Transaction>& consumerPool) : producerPool(producerPool), consumerPool(consumerPool) {
    // producerPool and consumerPool are passed by reference
    this->producerPool = producerPool;
    this->consumerPool = consumerPool;
    // create a thread that operates on the group
    thread = std::thread(&Group::groupRunable, this);
}

Group::~Group() {
    // join the thread
    if (thread.joinable()) {
        thread.join();
    }
}